Seasonal Monthly Mutual Information
data_monthly = data_monthly %>%
select(-c('meanPrecip', 'meanQ')) %>%
mutate(mon = month(month)) %>%
relocate(c("totQ", "mon"))
summary(data_monthly)
## totQ mon month
## Min. :0.000e+00 Min. : 1.000 Min. :1980-01-01 00:00:00.000
## 1st Qu.:3.321e-05 1st Qu.: 3.000 1st Qu.:1989-04-08 12:45:00.000
## Median :2.973e-03 Median : 6.000 Median :1998-07-16 12:00:00.000
## Mean :1.344e-02 Mean : 6.478 Mean :1998-07-17 01:15:52.465
## 3rd Qu.:1.640e-02 3rd Qu.: 9.000 3rd Qu.:2007-10-24 06:00:00.000
## Max. :2.005e-01 Max. :12.000 Max. :2017-02-01 00:00:00.000
## meanWTE meanPDSI totPrecip totSnow
## Min. :421.5 Min. :-5.6400 Min. : 0.160 Min. : 0.000
## 1st Qu.:421.9 1st Qu.:-2.2186 1st Qu.: 2.803 1st Qu.: 0.000
## Median :421.9 Median :-0.3522 Median : 5.230 Median : 0.900
## Mean :421.9 Mean :-0.2599 Mean : 6.517 Mean : 4.713
## 3rd Qu.:422.0 3rd Qu.: 1.6949 3rd Qu.: 9.115 3rd Qu.: 7.650
## Max. :422.1 Max. : 4.9926 Max. :32.710 Max. :32.700
nbins = 15
## Shift time series
lagTS = function(x, y, l){
#Shift
shiftedX = lag(x, n = l)
shiftedY = lag(y, n = 0)
#Merge into data frame and clip to non-na
dat = data.frame(shiftedX, shiftedY) %>%
drop_na()
return(dat)
}
#Seasonal calculation
calc_seasonalQ_contribution_Conditional = function(var, lag, data){
temp = c()
#Lag timeseries
lagDat = lagTS(data[, var], data$totQ, lag)
#Lag autocorrelation
lagY = lagTS(data$totQ, data$totQ, lag-1)
#Attach monthly values
lagDat = cbind(lagDat, month = data$mon[0:(length(data$mon)-lag)],
z = lagY$shiftedY[0:(length(lagY$shiftedY) - 1)])
for(i in seq(1, 12)){
#filter
lagDat_monthly = lagDat %>% filter(month == i)
#calculate mutual information
temp = append(temp, natstobits(condinformation(X = discretize(lagDat_monthly$shiftedX),
Y = discretize(lagDat_monthly$shiftedY),
S = discretize(lagDat_monthly$z))))
}
return(temp)
}
calc_seasonalQ_correlations = function(var, lag, data){
temp = c()
#Lag timeseries
lagDat = lagTS(data[, var], data$totQ, lag)
#Attach monthly values
lagDat = cbind(lagDat, month = data$mon[0:(length(data$mon)-lag)])
for(i in seq(1, 12)){
#filter
lagDat_monthly = lagDat %>% filter(month == i)
#correlation
temp = append(temp, cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY))
}
return(temp)
}
vars = c('totPrecip', 'meanWTE', 'meanPDSI', 'totSnow')
buff = 0.2
#Time series based plots
#Transfer Entropy, i.e. Conditional Mutual Information
for(lag in seq(1, 6)){
monthly_MI_data = data.frame(matrix(ncol = 0, nrow = 12))
monthly_R_data = data.frame(matrix(ncol = 0, nrow = 12))
for(v in vars){
monthly_MI_data[v] = calc_seasonalQ_contribution_Conditional(v, lag, data_monthly)
monthly_R_data[v] = calc_seasonalQ_correlations(v, lag, data_monthly)
}
#Plot stacked time series (plus shifted data)
x = seq(1:12)
months = c(x[(length(x)-lag+1):length(x)], x[1:(length(x)-lag)])
monthly_MI_data = monthly_MI_data %>%
mutate(month = months) %>%
gather(variable, value, vars)
monthlyplot = ggplot(data = monthly_MI_data, aes(x = month, y = value, fill = variable)) +
#Label Seasons first
#4, (4-lag)%%12
#7, (7-lag)%%12
#10, (10-lag)%%12
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_area() +
scale_fill_brewer(palette = "BrBG") +
xlim(1,12) +
ylim(0, 4) +
xlab('Month') +
ylab('Conditional Mutual Information') +
theme(legend.position = 'bottom',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
#streamplot = ggplot(data = dat, aes(x = yday(day), y = qInterval)) +
# stat_summary(fun = mean, geom = 'smooth', color = 'grey') +
# ylim(0, 0.002) +
# xlim(0, 365) +
# xlab('Day of Year') +
# ylab('Streamflow (m)') +
# ggtitle(paste0('Monthly Conditional Information, t = ', lag, ', l = 1')) +
# theme(panel.background = element_blank())
monthly_R_data = monthly_R_data %>%
mutate(month = months) %>%
gather(variable, value, vars)
monthlyplot_corr = ggplot(data = monthly_R_data, aes(x = month, y = value, col = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_line() +
geom_point() +
scale_color_brewer(palette = "BrBG") +
xlim(1,12) +
ylim(-1, 1) +
xlab('Month') +
ylab('Pearson R') +
ggtitle(paste0('Streamflow Contributions at lag ', lag)) +
theme(legend.position = 'none',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
fullplot = plot_grid(monthlyplot_corr, monthlyplot,
ncol = 1,
axis = 'l',
align = 'v',
rel_heights = c(2,3))
print(fullplot)
}
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.
## ℹ Please use `all_of()` or `any_of()` instead.
## # Was:
## data %>% select(vars)
##
## # Now:
## data %>% select(all_of(vars))
##
## See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 48 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 48 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).


#Variable based plots
#Transfer Entropy, i.e. Conditional Mutual Information
for(v in vars){
monthly_MI_var_data = data.frame(matrix(ncol = 0, nrow = 12))
monthly_R_var_data = data.frame(matrix(ncol = 0, nrow = 12))
for(lag in seq(1, 6)){
temp = calc_seasonalQ_contribution_Conditional(v, lag, data_monthly)
temp_corr = calc_seasonalQ_correlations(v, lag, data_monthly)
#time shift the MI values
monthly_MI_var_data[lag] = c(temp[(length(temp)-lag+1):length(temp)], temp[1:(length(temp)-lag)])
monthly_R_var_data[lag] = c(temp_corr[(length(temp_corr)-lag+1):length(temp_corr)], temp_corr[1:(length(temp_corr)-lag)])
}
#Plot stacked time series (plus shifted data)
x = seq(1:12)
monthly_MI_var_data = monthly_MI_var_data %>%
mutate(month = x) %>%
gather(variable, value, seq(1,6))
monthlyplot_stacked = ggplot(data = monthly_MI_var_data, aes(x = month, y = value, fill = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_area() +
scale_fill_brewer(palette = "PuBuGn") +
xlim(1,12) +
ylim(0, 4) +
xlab('Month') +
ylab('Conditional Mutual Information') +
theme(legend.position = 'bottom',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
monthly_R_var_data = monthly_R_var_data %>%
mutate(month = x) %>%
gather(variable, value, seq(1,6))
monthlyplot_corr = ggplot(data = monthly_R_var_data, aes(x = month, y = value, col = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_line() +
geom_point() +
scale_color_brewer(palette = "PuBuGn") +
xlim(1,12) +
ylim(-1, 1) +
xlab('Month') +
ylab('Pearson R') +
ggtitle(paste0('Lagged Streamflow Contributions from ', v)) +
theme(legend.position = 'none',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
fullplot = plot_grid(monthlyplot_corr, monthlyplot_stacked,
ncol = 1,
axis = 'l',
align = 'v',
rel_heights = c(2,3))
print(fullplot)
}
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).

## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 16 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 24 rows containing missing values or values outside the scale range
## (`geom_point()`).


#Sample correlation plots
lag = 6
for(v in vars){
#Lag timeseries
lagDat = lagTS(data_monthly[, v], data_monthly$totQ, lag)
#Shift monthly values
mos = (data_monthly$mon[0:(length(data_monthly$mon)-lag)] + lag)%%12
mos[mos == 0] = 12
#Attach monthly values
lagDat = cbind(lagDat, month = mos)
#plot(lagDat$shiftedY, col = 'blue')
#lines(data_monthly[, v])
#title(paste0('Variable: ', v, ' Lag: ', lag, ' Months'))
#PLot set up
par(mfrow = c(3, 4),
mar = c(2, 2, 2.5, 2))
for(i in seq(1, 12)){
#filter
lagDat_monthly = lagDat %>% filter(month == i)
plot(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY)
rug(lagDat_monthly$shiftedX, side = 1, col = 'red')
rug(lagDat_monthly$shiftedY, side = 2, col = 'red')
title(paste0('Month ', i))
}
mtext(v, side = 3, line = -1, outer = TRUE)
}




High and Low snow year breakdown
#Aggregate to snow year and sum snow inputs
snowAnnual = snow_daily %>%
mutate(snowYear = ifelse(month(day) < 10, year(day), year(day) + 1)) %>%
filter(snowYear > 1948) %>%
group_by(snowYear) %>%
summarise(totSnow = sum(Snow_in, na.rm=TRUE))
snowAnnual = snowAnnual %>%
mutate(type = ifelse(totSnow > mean(snowAnnual$totSnow), 'High', 'Low'))
head(snowAnnual)
## # A tibble: 6 × 3
## snowYear totSnow type
## <dbl> <dbl> <chr>
## 1 1949 37.1 Low
## 2 1950 86.5 High
## 3 1951 75 High
## 4 1952 52.7 Low
## 5 1953 37 Low
## 6 1954 80.5 High
#Sort into high and low snow year data frames (based on calendar year, not snow year)
highSnow_monthly = data_monthly %>%
filter(year(month) %in% snowAnnual$snowYear[snowAnnual$type == 'High'])
lowSnow_monthly = data_monthly %>%
filter(year(month) %in% snowAnnual$snowYear[snowAnnual$type == 'Low'])
print(head(highSnow_monthly))
## totQ mon month meanWTE meanPDSI totPrecip totSnow
## 1 8.760268e-05 1 1982-01-01 421.9313 -1.5093550 3.88 21.5
## 2 0.000000e+00 2 1982-02-01 421.9025 -1.1760718 1.88 4.7
## 3 1.480795e-04 3 1982-03-01 421.9335 -1.0590325 6.14 13.4
## 4 1.225498e-01 4 1982-04-01 422.0817 0.4429998 5.22 3.2
## 5 1.110399e-01 5 1982-05-01 422.0397 1.0151611 12.71 0.0
## 6 7.453906e-03 6 1982-06-01 421.9663 1.2383329 6.86 0.0
print(head(lowSnow_monthly))
## totQ mon month meanWTE meanPDSI totPrecip totSnow
## 1 5.684874e-05 1 1980-01-01 421.9126 -0.020000281 4.51 21.2
## 2 0.000000e+00 2 1980-02-01 421.8800 -0.009655426 1.90 7.1
## 3 0.000000e+00 3 1980-03-01 421.8516 -0.021613244 4.12 14.5
## 4 6.693354e-02 4 1980-04-01 421.9850 -0.346000482 1.00 0.9
## 5 1.053752e-02 5 1980-05-01 421.9494 -1.741613027 2.25 0.0
## 6 3.390590e-03 6 1980-06-01 421.9360 -2.940000183 10.03 0.0
Redo Mutual Information Analysis on snow breakdown
## High Snow Years
#Transfer Entropy, i.e. Conditional Mutual Information
for(v in vars){
monthly_MI_var_data = data.frame(matrix(ncol = 0, nrow = 12))
monthly_R_var_data = data.frame(matrix(ncol = 0, nrow = 12))
for(lag in seq(1, 6)){
temp = calc_seasonalQ_contribution_Conditional(v, lag, highSnow_monthly)
temp_corr = calc_seasonalQ_correlations(v, lag, highSnow_monthly)
#time shift the MI values
monthly_MI_var_data[lag] = c(temp[(length(temp)-lag+1):length(temp)], temp[1:(length(temp)-lag)])
monthly_R_var_data[lag] = c(temp_corr[(length(temp_corr)-lag+1):length(temp_corr)], temp_corr[1:(length(temp_corr)-lag)])
}
#Plot stacked time series (plus shifted data)
x = seq(1:12)
monthly_MI_var_data = monthly_MI_var_data %>%
mutate(month = x) %>%
gather(variable, value, seq(1,6))
monthlyplot_stacked = ggplot(data = monthly_MI_var_data, aes(x = month, y = value, fill = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_area() +
scale_fill_brewer(palette = "PuBuGn") +
xlim(1,12) +
ylim(0, 4) +
xlab('Month') +
ylab('Conditional Mutual Information') +
theme(legend.position = 'bottom',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
monthly_R_var_data = monthly_R_var_data %>%
mutate(month = x) %>%
gather(variable, value, seq(1,6))
monthlyplot_corr = ggplot(data = monthly_R_var_data, aes(x = month, y = value, col = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_line() +
geom_point() +
scale_color_brewer(palette = "PuBuGn") +
xlim(1,12) +
ylim(-1, 1) +
xlab('Month') +
ylab('Pearson R') +
ggtitle(paste0('Lagged Streamflow Contributions from ', v)) +
theme(legend.position = 'none',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
fullplot = plot_grid(monthlyplot_corr, monthlyplot_stacked,
ncol = 1,
axis = 'l',
align = 'v',
rel_heights = c(2,3))
print(fullplot)
}
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_align()`).

## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 16 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 24 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_align()`).


## Low Snow Years
#Transfer Entropy, i.e. Conditional Mutual Information
for(v in vars){
monthly_MI_var_data = data.frame(matrix(ncol = 0, nrow = 12))
monthly_R_var_data = data.frame(matrix(ncol = 0, nrow = 12))
for(lag in seq(1, 6)){
temp = calc_seasonalQ_contribution_Conditional(v, lag, lowSnow_monthly)
temp_corr = calc_seasonalQ_correlations(v, lag, lowSnow_monthly)
#time shift the MI values
monthly_MI_var_data[lag] = c(temp[(length(temp)-lag+1):length(temp)], temp[1:(length(temp)-lag)])
monthly_R_var_data[lag] = c(temp_corr[(length(temp_corr)-lag+1):length(temp_corr)], temp_corr[1:(length(temp_corr)-lag)])
}
#Plot stacked time series (plus shifted data)
x = seq(1:12)
monthly_MI_var_data = monthly_MI_var_data %>%
mutate(month = x) %>%
gather(variable, value, seq(1,6))
monthlyplot_stacked = ggplot(data = monthly_MI_var_data, aes(x = month, y = value, fill = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_area() +
scale_fill_brewer(palette = "PuBuGn") +
xlim(1,12) +
ylim(0, 4) +
xlab('Month') +
ylab('Conditional Mutual Information') +
theme(legend.position = 'bottom',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
monthly_R_var_data = monthly_R_var_data %>%
mutate(month = x) %>%
gather(variable, value, seq(1,6))
monthlyplot_corr = ggplot(data = monthly_R_var_data, aes(x = month, y = value, col = variable)) +
#Label Seasons first
geom_vline(xintercept = 4, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 4+buff, label="Melt Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 7, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 7+buff, label="Growing Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
geom_vline(xintercept = 10, linetype = "longdash", color = 'grey') +
geom_text(aes(x = 10+buff, label="Snow Season", y=4), colour="grey", hjust = 'right', angle=90, size = 3) +
#Plot
geom_line() +
geom_point() +
scale_color_brewer(palette = "PuBuGn") +
xlim(1,12) +
ylim(-1, 1) +
xlab('Month') +
ylab('Pearson R') +
ggtitle(paste0('Lagged Streamflow Contributions from ', v)) +
theme(legend.position = 'none',
panel.background = element_blank()) +
scale_x_continuous(n.breaks=12)
fullplot = plot_grid(monthlyplot_corr, monthlyplot_stacked,
ncol = 1,
axis = 'l',
align = 'v',
rel_heights = c(2,3))
print(fullplot)
}
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).

## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).

## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Warning in cor(x = lagDat_monthly$shiftedX, y = lagDat_monthly$shiftedY): the
## standard deviation is zero
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
## Warning in geom_text(aes(x = 4 + buff, label = "Melt Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 7 + buff, label = "Growing Season", y = 4), : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning in geom_text(aes(x = 10 + buff, label = "Snow Season", y = 4), colour = "grey", : All aesthetics have length 1, but the data has 72 rows.
## ℹ Please consider using `annotate()` or provide this layer with data containing
## a single row.
## Warning: Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Removed 72 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 16 rows containing missing values or values outside the scale range
## (`geom_line()`).
## Warning: Removed 24 rows containing missing values or values outside the scale range
## (`geom_point()`).

